package com.example.TokenUtil;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
public class HasLoginToken {
    //判断是否已经登录，并且生成token，避免重复登录！
     public static boolean hasLoginToken(HttpServletRequest request) {
        Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if ("token".equals(cookie.getName()) && !cookie.getValue().isEmpty()) {
                    return true;
                }
            }
        }
        return false;
    }
}
